using System.Collections;
using UnityEngine;

internal class MaxSpeedLimit : IPhysicalSupport
{
	private Rigidbody m_Rigidbody;

	private float m_MaxSpeed;

	public void Init(Hashtable table)
	{
		m_Rigidbody = (Rigidbody)table["Rigidbody"];
		m_MaxSpeed = (float)table["MaxSpeed"];
	}

	public void FixedCall()
	{
		if (m_Rigidbody.velocity.sqrMagnitude > m_MaxSpeed * m_MaxSpeed)
		{
			m_Rigidbody.velocity = m_Rigidbody.velocity.normalized * m_MaxSpeed;
		}
	}
}
